package com.kusiri.kframework.salesforce.model
{
	import com.kusiri.kframework.model.IKfValueObject;
	import com.salesforce.objects.SObject;
	import com.salesforce.results.DescribeSObjectResult;
	

	/**
	 * Represents a Salesforce object
	 * Note: Salesforce properties always start with Capital Letters
	 */
	public interface ISObject extends IKfValueObject
	{
		function __ensureFullyLoaded(onSuccess:Function, onFail:Function) : void;
		
		function __reload(onSuccess:Function, onFail:Function) : void;

		function get Id() : String;

		function get __type() : String;

		function get __stub() : Boolean;
		
		function get __model() : IKfSalesforceModel;
		
		function __initialize(obj:*, model:IKfSalesforceModel) : void;
		
		/**
		 * Set as stub that is being proxied
		 */
		function set __sourceStub(source:com.salesforce.objects.SObject) : void;
		
		/**
		 * Return the name shown to a user to identify the object
		 */
		function get __displayName() : String;
		
		/**
		 * Set the name shown to a user to identify the object
		 */
		function set __displayName(name:String) : void;

		/**
		 * Return the field names (columns)
		 */
		function get __fieldNames() : Array;
		
		/**
		 * Gets the metadata for the object
		 */
		function get __sfDescription() : DescribeSObjectResult;
		
		function __describeLayout(callback:Function, onFail:Function) : void;
		
		/**
		 * The sf record type (id)
		 * Restricted to master for now
		 */
		function get __recordType() : String;
		
		/**
		 * Converts a field of an sobject into a string for display
		 * 
		 */
		function __getPropertyAsText(property:String) : String;
		
		/**
		 * Clones the object, but not the sobject inside
		 */
		function __clone() : ISObject;
	}
}